Concurrent access for hierarchical data storage

ABSTRACT

Methods, systems, and computer-readable storage mediums are presented for aggregating multiple values for an object using database rows. Each value added to the database for the object may include a same primary key and a unique sequence key. This allows multiple values to be added for an object concurrently by simply adding additional rows to the database table. After values have been added, a process can identify multiple rows having the same primary key and aggregate the values stored in those rows together into a single database row having the primary key. This can be done as part of a garbage-collection routine or in response to other processes attempting to add additional values for the object.

CROSS-REFERENCES TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.13/714,626 filed on Dec. 14, 2012, which is incorporated herein byreference.

BACKGROUND OF THE INVENTION

In information technology and computer science, especially in the fieldsof computer programming, operating systems, multiprocessors, anddatabases, concurrency control ensures that correct results forconcurrent operations are generated, while getting those results asquickly as possible. Computer system components can be designed tointeract by sharing access to data (in memory or storage). The generalarea of concurrency control provides rules, methods, designmethodologies, and theories to maintain the consistency of componentsoperating concurrently while interacting, and thus the consistency andcorrectness of the computer system as a whole. Introducing concurrencycontrol into a system means applying operational constraints that in thepast have resulted in some performance reductions.

Managing large businesses may involve storing, aggregating, andanalyzing large amounts of data. Many organizations use EnterpriseSoftware Systems to manage almost every form of business data. Forexample, Enterprise Software Systems can provide business-oriented toolssuch as online shopping and online payment processing, interactiveproduct catalogs, automated billing systems, security, enterprisecontent management, IT service management, customer relationshipmanagement, enterprise resource planning, business intelligence, projectmanagement, collaboration, human resource management, manufacturing,enterprise application integration, and Enterprise forms automation.

Enterprise Software Systems can integrate internal and externalmanagement information across an entire organization. EnterpriseSoftware Systems may be used to automate activities between thesedifferent resources within an integrated software application. Onepurpose may be to facilitate the flow of information between businessfunctions across boundaries of an organization, and to manage theconnections between outside stakeholders and internal resources. Inthese areas, data concurrency controls may govern how various systemswithin an Enterprise Software System interact with shared datastructures, particularly hierarchical data structures.

BRIEF SUMMARY OF THE INVENTION

In one embodiment, a method of providing concurrent access to ahierarchy in a data structure may be discussed. The method may includereceiving a request from a first process to change a first valueassociated with an object, where the request may include a second valueto be combined with the first value. The method may also includedetermining that a second process is currently accessing informationassociated with the object. The method may additionally includeassociating, in response to determining that the second process iscurrently accessing information associated with the object, the secondvalue with the object without combining the first value and the secondvalue.

In some embodiments, the method may also include combining the firstvalue and the second value at a time when the second process is nolonger accessing the information associated with the object. The firstvalue and the second value may be combined as part of a data structureclean-up routine.

In other embodiments, the method may also include receiving a secondrequest to access the information associated with the object;determining that no other processes are currently accessing theinformation associated with the object; determining that the firstobject is associated with the first value and the second value; andcombining the first value and the second value. The object may includeone or more rows in a database, and associating the second value withthe object may include adding a row to the database that identifies theobject and includes the second value. The row and each of the one ormore rows may include a same functional primary key. The row and each ofthe one or more rows may include different sequence keys. The secondvalue may be associated with a child object of the object in thehierarchy, and the request from the first process may be part of a datarollup operation.

In some embodiments, the object may include one or more rows in adatabase, and the method may further include determining that the firstobject is associated with the first value and the second value, andcombining the first value and the second value at a time when the secondprocess is no longer accessing the information associated with theobject. The hierarchy may be a single-parent hierarchy. The hierarchymay be a multi-parent hierarchy. Additionally, a plurality of valuesassociated with the object may be bounded in size by the number ofprocesses concurrently most recently accessing the informationassociated with the object.

In another embodiment, a computer-readable memory may be presented. Thencomputer-readable memory may have stored thereon a sequence ofinstructions which, when executed by one or more processors, causes theone or more processors to provide concurrent access to a hierarchy in adata structure. The instructions may cause the processor(s) to receive arequest from a first process to change a first value associated with anobject, where the request may include a second value to be combined withthe first value. The instructions may also cause the processor(s) todetermine that a second process is currently accessing informationassociated with the object. The instructions may additionally cause theprocessor(s) to associate, in response to determining that the secondprocess is currently accessing information associated with the object,the second value with the object without combining the first value andthe second value.

In yet another embodiment, a system may be presented. The system mayinclude one or more processors and a memory communicatively coupled withand readable by the one or more processors. The memory may have storedtherein a sequence of instructions which, when executed by the one ormore processors, cause the one or more processors to provide concurrentaccess to a hierarchy in a data structure. The instructions may causethe processor(s) to receive a request from a first process to change afirst value associated with an object, where the request may include asecond value to be combined with the first value. The instructions mayalso cause the processor(s) to determine that a second process iscurrently accessing information associated with the object. Theinstructions may additionally cause the processor(s) to associate, inresponse to determining that the second process is currently accessinginformation associated with the object, the second value with the objectwithout combining the first value and the second value.

BRIEF DESCRIPTION OF THE DRAWINGS

A further understanding of the nature and advantages of the presentinvention may be realized by reference to the remaining portions of thespecification and the drawings, wherein like reference numerals are usedthroughout the several drawings to refer to similar components. In someinstances, a sub-label is associated with a reference numeral to denoteone of multiple similar components. When reference is made to areference numeral without specification to an existing sub-label, it isintended to refer to all such multiple similar components.

FIG. 1 illustrates a block diagram of components of an exemplaryoperating environment in which various embodiments of the presentinvention may be implemented.

FIG. 2 illustrates a block diagram of an exemplary computer system inwhich embodiments of the present invention may be implemented.

FIG. 3 illustrates a block diagram of a data structure, according to oneembodiment.

FIG. 4 illustrates a flowchart of a method for concurrently accessing ahierarchy, according to one embodiment.

FIGS. 5A-5E illustrate two processes concurrently rolling data up ahierarchy, according to one embodiment.

FIGS. 6A-6D illustrate a database implementation for concurrentlyaccessing hierarchical data, according to one embodiment.

FIG. 7 illustrates a flowchart of a method for updating a hierarchy,according to one embodiment.

FIG. 8 illustrates a block diagram of a data management system,according to one embodiment.

DETAILED DESCRIPTION

In the following description, for the purposes of explanation, numerousspecific details are set forth in order to provide a thoroughunderstanding of various embodiments of the present invention. It willbe apparent, however, to one skilled in the art that embodiments of thepresent invention may be practiced without some of these specificdetails. In other instances, well-known structures and devices are shownin block diagram form.

The ensuing description provides exemplary embodiments only, and is notintended to limit the scope, applicability, or configuration of thedisclosure. Rather, the ensuing description of the exemplary embodimentswill provide those skilled in the art with an enabling description forimplementing an exemplary embodiment. It should be understood thatvarious changes may be made in the function and arrangement of elementswithout departing from the spirit and scope of the invention as setforth in the appended claims.

Specific details are given in the following description to provide athorough understanding of the embodiments. However, it will beunderstood by one of ordinary skill in the art that the embodiments maybe practiced without these specific details. For example, circuits,systems, networks, processes, and other components may be shown ascomponents in block diagram form in order not to obscure the embodimentsin unnecessary detail. In other instances, well-known circuits,processes, algorithms, structures, and techniques may be shown withoutunnecessary detail in order to avoid obscuring the embodiments.

Also, it is noted that individual embodiments may be described as aprocess which is depicted as a flowchart, a flow diagram, a data flowdiagram, a structure diagram, or a block diagram. Although a flowchartmay describe the operations as a sequential process, many of theoperations can be performed in parallel or concurrently. In addition,the order of the operations may be re-arranged. A process is terminatedwhen its operations are completed, but could have additional steps notincluded in a figure. A process may correspond to a method, a function,a procedure, a subroutine, a subprogram, etc. When a process correspondsto a function, its termination can correspond to a return of thefunction to the calling function or the main function.

The term “machine-readable medium” includes, but is not limited toportable or fixed storage devices, optical storage devices, wirelesschannels and various other mediums capable of storing, containing orcarrying instruction(s) and/or data. A code segment ormachine-executable instructions may represent a procedure, a function, asubprogram, a program, a routine, a subroutine, a module, a softwarepackage, a class, or any combination of instructions, data structures,or program statements. A code segment may be coupled to another codesegment or a hardware circuit by passing and/or receiving information,data, arguments, parameters, or memory contents. Information, arguments,parameters, data, etc., may be passed, forwarded, or transmitted via anysuitable means including memory sharing, message passing, token passing,network transmission, etc.

Furthermore, embodiments may be implemented by hardware, software,firmware, middleware, microcode, hardware description languages, or anycombination thereof. When implemented in software, firmware, middlewareor microcode, the program code or code segments to perform the necessarytasks may be stored in a machine readable medium. A processor(s) mayperform the necessary tasks.

Described herein, are embodiments for concurrently accessing hierarchiesof data. In a parent-child hierarchy of data objects, it is possiblethat two or more separate processes may attempt to access a single dataset at the same time. In some cases, these different processes can loaddata that affects overlapping subsets of objects. This may beparticularly true in a data hierarchy where changes to child objects are“rolled up” through the hierarchy. In one embodiment, the new values canbe added to child objects, and these new values can be aggregatedthrough each parent object in the hierarchy. The methods and systemsdescribed herein allow for these data roll ups to happen concurrentlyand for aggregated amounts for any object to be queried in real-time.

These methods and systems can be applied across to a wide range ofcomputing hardware and/or software systems. For example, in a reportingsolution, such as the Resource Management Dashboard provided by Oracle®Fusion applications, objects within a hierarchy may represent resourcesmanaged by the Enterprise Software System. In other words, child objectsmay represent an employee, a computing resource, a department, aproject, an IT asset, and/or the like. These objects can be arranged ina hierarchy in order to quickly query resource use in different levelsof an organization. For example, child objects may represent computingresources at a particular location. A parent object may represent atotal load of the computing resources at the particular location. A useror process may query either an individual object to see that resource'sworkload, or alternatively may query the parent object to see the totalworkload for all of the resources at the particular location. Similarly,a grandparent object could represent the aggregate total of resourceworkloads at various locations within a particular region, and so on.

In these types of reporting solutions, there may exist a need to rolldata up the hierarchy at some point after a child object is accessedand/or updated. There may also exist a need to query data at anyparticular object level in real-time. Furthermore, there can be manydifferent functional methods that create or identify data against theobjects in the hierarchy, and each of these functional methods may haveunique data needs. Therefore, it may not be an uncommon situation formany processes to attempt to access/view/update information residingwithin one or more nodes within the hierarchy at approximately the sametime.

Previous solutions to the problem of rolling data up a hierarchy havegenerally not allowed multiple processes to roll data up the hierarchyat the same time. In these solutions, the first process to access a dataset would acquire the exclusive ability to update data objects withinthe data set. In a hierarchy, an accessing process could receiveexclusive control over objects within a hierarchical line, such that achange to a child object could be rolled up through the hierarchywithout colliding with other processes. Therefore, any processes thattried access the data set while the first process had exclusive controlwould have to simply wait until the first process was finishedperforming its data operations and subsequently relinquished exclusivecontrol.

Because every process had to wait for other processes to finish, lagtime between when data was created and when it was accessible by a queryin a stored format increased. This lag time may be attributed to latencyin processing the data, time spent managing the overhead of variousprocesses, and the time it took for an accessing process to work its waythrough the queue of processes waiting to gain exclusive control. Thislag time could affect functionality, in that data could become stalewhile it waited for other processes to update the data structure.Furthermore, additional complexity and overhead may be introduced insuch previous solutions since it may be necessary to have methods inplace to queue the various processes or to have priorities assigned tothe various processes that want to roll data up the hierarchy.

As described, previous solutions do not allow rolling data up thehierarchy by multiple processes at the same time while allowing theaggregated data to be accessed by a query in real-time for either theprocesses rolling up the data or for the processes querying theaggregated data. The methods and solutions described herein achieve thisby, among other things, relaxing a constraint that is typically enforcedon data in a relational data structure. Typically, objects within therelational data structure include a primary key. The relational datastructure typically only allows one entry using a given primary key. Incontrast, the methods and systems described herein relax thisrestriction and allow multiple values to exist for a single primary key.In other words, duplicate rows can be added to a database containingdifferent values.

The methods and solutions described herein may also add an additionalstep of aggregation to the access routine based on a query. Becausemultiple values may exist for a single primary key, accessing a dataobject associated with a primary key may involve detecting thesemultiple values and aggregating their values into a single value.Although this may require an additional aggregation step, theembodiments described herein can guarantee that the number of multiplevalues to be aggregated in the additional aggregation step will be keptlow. Specifically, the size of the data set that the query needs toaggregate can be at most a multiple of the size after the aggregation,and in practice the multiple can be close to or equal to 1 (note thatthe multiple need not necessarily be an integer value). The upper boundwill be equal to the number of processes that were rolling up data atone time most recently to the objects or dataset in the hierarchy thatthe query is currently accessing. So, the amount of data that needs tobe aggregated by a query accessing the data in the hierarchy is notdependent on the size of the hierarchy. This makes these methodsscalable to any size data structure. The upper bound can increase and/ordecrease with load on the system.

The remainder of this disclosure will describe in detail variousembodiments of methods and systems for concurrent access to datahierarchies. First, an exemplary computer system and network environmentwill be described that can be used to implement various aspects of theseembodiments. Next, a general description of the solution will bedescribed in relation to a generic data structure. Afterwards, anexemplary embodiment will be illustrated using a relational database. Itwill be understood that the specific embodiment is merely exemplary, andprovided simply to aid in the understanding of certain aspects ofvarious embodiments.

Each of the embodiments disclosed herein may be implemented in acomputer system. FIG. 1 is a block diagram illustrating components of anexemplary operating environment in which various embodiments of thepresent invention may be implemented. The system 100 can include one ormore user computers 105, 110, which may be used to operate a client,whether a dedicated application, web browser, etc. The user computers105, 110 can be general purpose personal computers (including, merely byway of example, personal computers and/or laptop computers runningvarious versions of Microsoft Corp.'s Windows and/or Apple Corp.'sMacintosh operating systems) and/or workstation computers running any ofa variety of commercially-available UNIX or UNIX-like operating systems(including without limitation, the variety of GNU/Linux operatingsystems). These user computers 105, 110 may also have any of a varietyof applications, including one or more development systems, databaseclient and/or server applications, and web browser applications.Alternatively, the user computers 105, 110 may be any other electronicdevice, such as a thin-client computer, Internet-enabled mobiletelephone, and/or personal digital assistant, capable of communicatingvia a network (e.g., the network 115 described below) and/or displayingand navigating web pages or other types of electronic documents.Although the exemplary system 100 is shown with two user computers, anynumber of user computers may be supported.

In some embodiments, the system 100 may also include a network 115. Thenetwork may be any type of network familiar to those skilled in the artthat can support data communications using any of a variety ofcommercially-available protocols, including without limitation TCP/IP,SNA, IPX, AppleTalk, and the like. Merely by way of example, the network115 may be a local area network (“LAN”), such as an Ethernet network, aToken-Ring network and/or the like; a wide-area network; a virtualnetwork, including without limitation a virtual private network (“VPN”);the Internet; an intranet; an extranet; a public switched telephonenetwork (“PSTN”); an infra-red network; a wireless network (e.g., anetwork operating under any of the IEEE 802.11 suite of protocols, theBluetooth protocol known in the art, and/or any other wirelessprotocol); and/or any combination of these and/or other networks such asGSM, GPRS, EDGE, UMTS, 3G, 2.5 G, CDMA, CDMA2000, WCDMA, EVDO etc.

The system may also include one or more server computers 120, 125, 130which can be general purpose computers and/or specialized servercomputers (including, merely by way of example, PC servers, UNIXservers, mid-range servers, mainframe computers rack-mounted servers,etc.). One or more of the servers (e.g., 130) may be dedicated torunning applications, such as a business application, a web server,application server, etc. Such servers may be used to process requestsfrom user computers 105, 110. The applications can also include anynumber of applications for controlling access to resources of theservers 120, 125, 130.

The web server can be running an operating system including any of thosediscussed above, as well as any commercially-available server operatingsystems. The web server can also run any of a variety of serverapplications and/or mid-tier applications, including HTTP servers, FTPservers, CGI servers, database servers, Java servers, businessapplications, and the like. The server(s) also may be one or morecomputers which can be capable of executing programs or scripts inresponse to the user computers 105, 110. As one example, a server mayexecute one or more web applications. The web application may beimplemented as one or more scripts or programs written in anyprogramming language, such as Java™, C, C# or C++, and/or any scriptinglanguage, such as Perl, Python, or TCL, as well as combinations of anyprogramming/scripting languages. The server(s) may also include databaseservers, including without limitation those commercially available fromOracle®, Microsoft®, Sybase®, IBM® and the like, which can processrequests from database clients running on a user computer 105, 110.

In some embodiments, an application server may create web pagesdynamically for displaying on an end-user (client) system. The web pagescreated by the web application server may be forwarded to a usercomputer 105 via a web server. Similarly, the web server can receive webpage requests and/or input data from a user computer and can forward theweb page requests and/or input data to an application and/or a databaseserver. Those skilled in the art will recognize that the functionsdescribed with respect to various types of servers may be performed by asingle server and/or a plurality of specialized servers, depending onimplementation-specific needs and parameters.

The system 100 may also include one or more databases 135. Thedatabase(s) 135 may reside in a variety of locations. By way of example,a database 135 may reside on a storage medium local to (and/or residentin) one or more of the computers 105, 110, 115, 125, 130. Alternatively,it may be remote from any or all of the computers 105, 110, 115, 125,130, and/or in communication (e.g., via the network 120) with one ormore of these. In a particular set of embodiments, the database 135 mayreside in a storage-area network (“SAN”) familiar to those skilled inthe art. Similarly, any necessary files for performing the functionsattributed to the computers 105, 110, 115, 125, 130 may be storedlocally on the respective computer and/or remotely, as appropriate. Inone set of embodiments, the database 135 may be a relational database,such as Oracle 10g, that is adapted to store, update, and retrieve datain response to SQL-formatted commands.

FIG. 2 illustrates an exemplary computer system 200, in which variousembodiments of the present invention may be implemented. The system 200may be used to implement any of the computer systems described above.The computer system 200 is shown comprising hardware elements that maybe electrically coupled via a bus 255. The hardware elements may includeone or more central processing units (CPUs) 205, one or more inputdevices 210 (e.g., a mouse, a keyboard, etc.), and one or more outputdevices 215 (e.g., a display device, a printer, etc.). The computersystem 200 may also include one or more storage device 220. By way ofexample, storage device(s) 220 may be disk drives, optical storagedevices, solid-state storage device such as a random access memory(“RAM”) and/or a read-only memory (“ROM”), which can be programmable,flash-updateable and/or the like.

The computer system 200 may additionally include a computer-readablestorage media reader 225 a, a communications system 230 (e.g., a modem,a network card (wireless or wired), an infra-red communication device,etc.), and working memory 240, which may include RAM and ROM devices asdescribed above. In some embodiments, the computer system 200 may alsoinclude a processing acceleration unit 235, which can include a DSP, aspecial-purpose processor and/or the like.

The computer-readable storage media reader 225 a can further beconnected to a computer-readable storage medium 225 b, together (and,optionally, in combination with storage device(s) 220) comprehensivelyrepresenting remote, local, fixed, and/or removable storage devices plusstorage media for temporarily and/or more permanently containingcomputer-readable information. The communications system 230 may permitdata to be exchanged with the network 220 and/or any other computerdescribed above with respect to the system 200.

The computer system 200 may also comprise software elements, shown asbeing currently located within a working memory 240, including anoperating system 245 and/or other code 250, such as an applicationprogram (which may be a client application, web browser, mid-tierapplication, RDBMS, etc.). It should be appreciated that alternateembodiments of a computer system 200 may have numerous variations fromthat described above. For example, customized hardware might also beused and/or particular elements might be implemented in hardware,software (including portable software, such as applets), or both.Further, connection to other computing devices such as networkinput/output devices may be employed. Software of computer system 200may include code 250 for implementing embodiments of the presentinvention as described herein.

Each of the methods described herein may be implemented by a computersystem, such as computer system 200 in FIG. 2. Each step of thesemethods may be executed automatically by the computer system, and/or maybe provided with inputs/outputs involving a user. For example, a usermay provide inputs for each step in a method, and each of these inputsmay be in response to a specific output requesting such an input,wherein the output is generated by the computer system. Each input maybe received in response to a corresponding requesting output.Furthermore, inputs may be received from a user, from another computersystem as a data stream, retrieved from a memory location, retrievedover a network, requested from a web service, and/or the like. Likewise,outputs may be provided to a user, to another computer system as a datastream, saved in a memory location, sent over a network, provided to aweb service, and/or the like. In short, each step of the methodsdescribed herein may be performed by a computer system, and may involveany number of inputs, outputs, and/or requests to and from the computersystem which may or may not involve a user. Therefore, it will beunderstood in light of this disclosure, that each step and each methoddescribed herein may be altered to include an input and output to andfrom a user, or may be done automatically by a computer system.Furthermore, some embodiments of each of the methods described hereinmay be implemented as a set of instructions stored on a tangible,non-transitory storage medium to form a tangible software product.

FIG. 3 illustrates a block diagram 300 of a data structure, according toone embodiment. This block diagram 300 may be representative of manydifferent data structures that can be organized as a hierarchy. Thesedata structures may include trees, binary trees, relational databases,linked lists, hash maps, arrays, vectors, matrices, and/or the like.Block diagram 300 is organized as a tree simply to show the parent-childrelationships, not necessarily because it represents a tree datastructure. Although the data structure illustrated in FIG. 3 is asingle-parent data structure, this is only for simplicity. The methodsand systems described herein may apply equally to multi-parents datastructures as well.

The data structure may be comprised of a number of different objects.These objects may also be referred to as nodes, entries, rows, and/orelements. Each object may be associated with one or more child objects,as well as one or more parent objects. For example, object 302 is aparent object of object 304, object 306, and object 308. Object 310 isrelated to object 302 and object 306 through a relationship within thehierarchy. This relationship may be a grandparent, great grandparent,and so forth, depending upon the number of objects between object 306and object 310.

In a hierarchical data structure where values can be rolled up the datastructure as they are entered into child objects, a change to a childobject may result in changes to each parent, grandparent, etc.throughout the hierarchy. For example, a change to object 310 may berolled up to change object 306 and object 302. Therefore, a set ofobjects can be identified in the parent-child hierarchy that may beaffected by any change. This set of objects can generally be defined asthe ancestors to the child object accepting the change.

For example, process 314 may access an object 310 and change the valuestored therein. The set of objects that may be affected by this changevalue may include object 310, object 306, object 302, and other objectsnot shown specifically by the block diagram 300 that are organizedbetween object 306 and object 310. In some embodiments, process 314 maybe granted exclusive access to change the values within this set ofobjects. In one embodiment, exclusive access may be grantedone-at-a-time to each object within the set of objects. In anotherembodiment, exclusive access may be granted to the entire set of objectsat once.

Although the embodiment illustrated by FIG. 3 may be performed on eachindividual object in the hierarchy, other embodiments may operate onmultiple objects during a single grant of exclusive control. Forexample, other embodiments may grant exclusive control to a “branch” ofthe hierarchy or to some other subset of objects in the hierarchy. Inanother embodiment, a data system storing the hierarchy of objects maybe processing roll ups for a plurality of objects around the same timeinterval. In other words, multiple processes may access a singlehierarchical data set at around the same time. In some cases, thesemultiple processes may access branches that result in data collisions,while in other cases these multiple processes may largely operateindependently on the data set without collisions when exclusive controlis granted.

After process 314 changes the value of object 310, that value change maybe propagated up to object 306. Next, the value change may propagated toobject 302. In this example, a second process, namely process 312 mayalso be currently rolling data up the hierarchy. If process 312 makeschange to object 304, then that value change may also be propagated upto object 302. In this case, the value change initiated by process 314may win the race and gain exclusive access to change the value of object302. Therefore, the process change initiated by process 312 may not alsohave access to the same memory location in which the value for object302 is stored.

In one embodiment, a method may be followed for processes that canachieve exclusive control as well as those processes that are excludedfrom the memory location storing the value for a particular object. FIG.4 illustrates a flowchart 400 of a method for concurrently accessing ahierarchy, according to one embodiment. This method may be applied toeach object one-at-a-time by each process as data is rolled up by thehierarchy (401), or in parallel for all ancestors using sub-processes.Also, the locks can be attempted first for all ancestors by each processand then the data rollups can be performed by each process for the wholehierarchy in, for example, two operations using SQL operations (e.g.,one SQL command for the locked objects and one SQL command for thenon-locked objects). Each process may first attempt to obtain exclusivecontrol over the object (402). As used herein, exclusive control mayalso be referred to as a “lock” on the object. A lock may be implementedusing a semaphore, or any other similar programming technique. It shouldbe noted that while the methods herein describe the lock occurring atthe object level, these methods would work similarly if the lock wereattempted at the functional primary key level (which may include theobject identifier and can include some additional identifiers, describedin greater detail below).

If no other processes have previously obtained the lock, then thecurrent process may obtain the lock (404). However, if another processhas already obtained the lock, then the current process might not havedirect access to a memory location storing the value associated with theobject. In some embodiments, if the process does not immediately obtaina lock upon request, then the lock may not be obtained at all. As usedherein, an object may be associated with various pieces of information.Information associated with the object may include a memory locationstoring data associated with the object. For example, an object in atree data structure may have a “value” memory location allocated tostore a numerical value for that particular object. In a relationaldatabase, a row of data or a particular field within a row may be usedto store a particular value.

Note that in previous solutions, if a lock is not obtained, the currentprocess would have to wait until the locking process finished accessingthe object value and returned the lock. In contrast, in some embodimentsdescribed herein, the current process can associate a new value with theobject (414). This association may take place while another processholds the lock. In this context, “associating” can be somethingdifferent than accessing the actual value associated with the object. Insome embodiments, associating a new value with the object may compriseadding a link to a new value. In other embodiments, associating a newvalue with the object may comprise adding an additional row using aprimary key associated with the object. Generally, this step may resultin at least two values existing at the same time that are associatedwith a particular object. These two values can be allowed to persistuntil another object obtains the lock on the object or the object isqueried for viewing. Generally, “associating” a value with an object maysimply be a different function than writing or storing a value in anobject. These differences depend upon the particular data structureimplementation of the hierarchy. However, it can be stated that theprocess obtaining the lock will store a value differently than theprocess not obtaining the lock.

Instead of waiting for the other process to return the lock, the currentprocess can simply associate the new value with the object. Then, thecurrent process can move to the next ancestor object (416), or wait forthe other ancestors that are being done in parallel, or process all thedata at once using SQL operations. Note that the process holding thelock may finish processing the current object and also try to update avalue in the next ancestor object as well. It does not matter which ofthe two competing processes acquires the lock on the next ancestorobject. In some cases, processes may alternate acquiring the lock asthey move up the data hierarchy, and in some cases the distribution oflocks may be completely arbitrary if, for example, process 312 andprocess 314 themselves use multiple sub-processes each to rollup data toall of their respective ancestors in parallel, or if process 312 andprocess 314 attempt to obtain locks on all of their respective ancestorsfirst before using, for example, SQL operations to rollup the data toall ancestors at once.

If the current process obtains the lock on the object, then otherprocesses attempting to access the object at the same time can followthe procedure described above, and can associate their values with theobject. The process obtaining the lock can get a list of all the valuesassociated with the object (406). In one embodiment, this may be doneusing a function that returns the ROWIDs for each row in a databaseassociated with a functional primary key. It should be noted that itdoes not affect the methods if new values are associated to the objecteven after the process obtaining the lock has received the list ofvalues (and before it returns the lock), since those values will simplybe aggregated by any process querying the data.

The locking process can then combine all of the values associated withthe object to create a single value (408). As used herein, the term“combine” may include any function that can be used to combine values.For example, the associated values may be added (aggregated),subtracted, multiplied, divided, etc. In one embodiment, each object mayrepresent a particular resource, and associated values may be aggregatedtogether to determine a workload for the object.

Optionally, the locking process may combine the associated values with anew value provided by the process itself (410). For example, an objectmay have three values associated with the object stored in memory. Thelocking process may provide a fourth value and aggregate all four valuestogether to form a single, new value. In one embodiment, this mayinclude committing values to a database and deleting the rows identifiedby the initial ROWID operation for the functional primary key of theobject.

Steps 406, 408, and 412 may also be carried out in response to a queryto view the object value. Therefore, multiple values for a single objectmay persist until a process obtains a lock on the object, or until aprocess views the object. The viewing operation may require the computersystem to aggregate or combine all of the values associated with theobject. This operation may be carried out by the user interface, butwill more typically be carried out by the data management systemcontrolling access to the hierarchical data structure. In practice thereare likely to be many more processes concurrently trying to view thedata than there concurrently are processes concurrently trying to rollupthe data.

When rolling values up a hierarchy, the process described by FIG. 4 maybe repeated for each ancestor object affected by an initial valuechange, or may be executed for all the ancestor objects in paralleleither, for example, by using parallel sub-processes or by performingactions across all hierarchy data via, for example, SQL operations onthe tables that contain the data. Described next is a generic example ofprocesses concurrently accessing an object and rolling a value change upa hierarchy of objects.

FIGS. 5A-5E illustrate two processes concurrently rolling data up ahierarchy, according to one embodiment. Although the data structure 500illustrated by these figures appears to be a tree structure, it shouldbe interpreted more generally as a graphical representation of aparent-child hierarchy. It will be understood that any data structurethat can represent hierarchies may be used instead. FIG. 5A illustratesthe data structure 500 where two competing processes are attempting tocombine new values with an object.

Specifically, process 508 is attempting to combine the value “1” withobject 506. Around the same time, process 510 may be attempting tocombine the value “5” with object 506. Object 506 may already have avalue of “3” stored therein. Process 508 may successfully obtain a lockon object 506. Therefore, process 508 may first detect any additionalvalues associated with object 506 (in this case there are none), andthen combine those values and the value “3” stored therein with thevalue of “1”.

Process 510, on the other hand, may not obtain the lock on object 506,because the lock was previously obtained by process 508. Therefore,process 510 may associate the value of “5” with object 506 instead ofaggregating and combining values like process 508. In one embodiment,this may comprise storing the value of “5” to another memory locationand adding a pointer to object 506, adding an entry to a database tableusing a primary key of object 506, or writing another entry into a list,vector, queue, array, and/or the like.

FIG. 5B illustrates the data structure 500 after process 508 releasesthe lock on object 506. The value stored in object 506 now includes theexisting value (“3”) combined with the new value (“1”) added by process508. It also shows that the value added by process 510 (“5”) has beenassociated with object 506. In this embodiment, combining objects mayinclude simply aggregating values together.

Because object 506 is part of the data hierarchy, the changed valuesmust be rolled up the hierarchy. Therefore, process 508 and process 510may again compete for a lock on object 502. In this case, process 510may obtain the lock on object 502. Therefore process 510 may combine thevalue of “5” with the value of “10” already stored in object 502 (alongwith any other values associated with object 502). Also, process 508 mayassociate the value of “1” with object 502 as described above.

FIG. 5C illustrates the data structure 500 after process 510 releasesthe lock on object 502. Note that both object 502 and object 506 have avalue stored therein, as well as values associated with the objects.Multiple values are allowed to persist until a process acquires a lockon object 502 and/or object 506, or until a process accesses, views, orqueries object 502 and/or 506. In one embodiment, an automated processmay be employed to periodically check objects within the data structure500 in order to detect multiple values and combine these values into asingle value for each object. This automated process may operate in afashion similar to a garbage collector for a memory management system.

FIG. 5D illustrates the data structure 500 when a process, such asprocess 508 attempts to access an object with one or more valuesassociated with the object. As part of the view/access/query, process508 may initiate a series of steps similar to when a process obtains alock on an object. For example, process 508 may retrieve a value storedin object 502, along with any values associated with object 502, andcombine them. In this case, the values of “11” and “5” may be combinedand stored in object 502 in response to the view/access/query of process508.

In some implementations, the higher volume of UI queries may be deemedtoo excessive for each UI process to compete for locks, and forcing eachUI to have the overhead of performing inserts/updates/deletes may beundesireable. In these implementations, the UIs may simply aggregate thedata each and every time it accesses an object, relying on the guaranteethat the number of rows they needs to aggregate has been kept low as waspreviously discussed. Allowing the UI to simply perform SQL queries toselect/aggregate object values rather than attempting to obtain a lockmay also eliminate the need for additional Java programming in the UI.

FIG. 5E illustrates the data structure 500 after process 508 accessesobject 502. Note that the value stored in object 502 and the valuesassociated with object 502 have been combined during the access process.(Again, the query or viewing process may simply aggregate the totalswithout acquiring a lock, deleting duplicates, and storing the newvalues.) The values for object 506 can remain separate until object 506is accessed, until object 506 is written to, or until an automatedprocess detects multiple values and combines them automatically.Combining values on demand may alleviate strain on system resources.

As described above, data structure 500 may be implemented using anyhierarchical data structure. Merely by way of example, data structure500 may be implemented using a relational database. In order to describethis example fully, a similar series of steps will now be using arelational database.

FIGS. 6A-6D illustrate a database implementation for concurrentlyaccessing hierarchical data, according to one embodiment. FIG. 6Aillustrates a database table 600 storing information for a particularobject or set of objects. In most database implementations, a primarykey is a unique key used to identify individual entries in a databasetable. A primary key must be unique, and this requirement is generallyenforced by the database system. Because the methods and systemsdescribed herein allow for multiple entries with a same primary key, anew field may be added to each table entry. For example, a functionalprimary key may identify an object. To this, a sequence number may beadded that is guaranteed to be unique for each entry for each objectacross all of the object's fields.

In this example, entry 604 and entry 606 may each be associated with afunctional primary key identifying the same object. A sequence numbermay be added to each of entry 604 and entry 606 in order to distinguishthem and the values associated with those entries. Note that additionalentries may also be associated with object Ni represented by theellipses above and below entry 604 and entry 606, respectively.

Entry 608 represents an additional value to be combined with the object.In some cases, this may come from a process attempting to write a newvalue to the object. In this example, entry 608 represents data to berolled up from object Nj, which may be a child object of object Ni. Inthis particular case, entry 608 does not yet have a sequence number, butit may receive one once written to table 600.

For purposes of this example, it may be assumed that a second processalready has a lock on object Ni. Therefore, entry 608 cannot be simplycombined with an existing entry of table 600, but instead entry 608 maybe associated with object Ni by writing the data to a new row in table600. FIG. 6B illustrates table 600 after entry 608 is associated withobject Ni and written to table 600. Entry 610 may represent entry 608with a sequence number added to the entry. At this point, there arethree values associated with object Ni.

FIG. 6C illustrates table 600 when a new value is to be combined withobject Ni. For purposes of this example, it may be assumed that theprocess adding entry 612 to object Ni is able to obtain a lock on objectNi. In the database implementation, this process may use a ROWIDfunction to return the primary keys of entry 604, entry 606, and entry610. The values for each of these entries may then be combined with thevalue of entry 612 in order to generate a single value for object Ni. Itshould be noted that while this process has a lock on object Ni, otherprocesses may add new entries to table 600 that will not be aggregatedby this process. These duplicate values may be allowed to persist untilanother modify/query/access operation takes place on object Ni.

In this particular embodiment, the functional primary key may havemultiple columns associated with it. In this example, one columncontains the values A and B. These values may correspond to differentresources represented by the object, such as different users of aworkstation, and/or the like. It may be possible for a process to queryspecific columns within the functional primary key of an object thataggregates/returns only those values associated with, for example, A orB. Other embodiments may use a single value for the functional primarykey and may simply aggregate and return all values associated with thefunctional primary key.

FIG. 6D illustrates table 600 after an aggregation procedure has takenplace for column B of the functional primary key. The accessing processmay use the row IDs returned by the initial ROWID process to extract avalue stored therein and combined them with the new value. Therefore,entry 606 and entry 610 may be deleted if the original ROWID command wasspecific to entries with the B value. A new entry 614 may contain thecombined value (15+3+6=24). This step may also comprise committing thechanges to the database to be reflected in its live data.

FIG. 7 illustrates a flowchart 700 of a method for updating a hierarchy,according to one embodiment. This method may be implemented using eithera general purpose computer system, or a dedicated hardware systemdescribed in relation to FIG. 8 below. The method may include receivinga request from a first process to change a first value associated withan object (702). In one embodiment, the first process may be part of adatabase management system, and may originate from an internal orexternal system. In one embodiment, the second process may originatefrom a user workstation operating as part of an Enterprise SoftwareSystem.

The method may also include determining that a second process iscurrently accessing information associated with the object (704). Theinformation associated with the object may comprise a row in a databasetable, a database table itself, an entry in a data structure, a valueassociated with a pointer stored in a database structure, and/or thelike. In one embodiment, the object may be part of a hierarchical datastructure comprised of parent-child relationships. In one embodiment,the data structure may comprise a relational database. The object may beassociated with one or more rows having the same functional primary key,or primary key. Each of these rows may have different sequence keys.

The method may additionally include associating the second value withthe object without combining the first value and the second value (706).The second value may be associated with a child object of the object inthe hierarchy. Associating the second value with the object may occur inresponse to a determination that the second process is currentlyaccessing information associated with the object. In the case of arelational database, the object may comprise one or more rows in thedatabase, and associating the second value with the object may compriseadding a row to the database that identifies the object and includes thesecond value. In one embodiment, this may include a database entryhaving a same functional primary key as the one or more rows associatedwith the object, and/or a different sequence key.

In some cases, operations may be performed to combine the first valueand the second value. These operations may take place automatically in agarbage-collector-like process, or may take place based on a request toview/access/modify the object. In the case of an automatic process, themethod may further include determining that the second process is nolonger accessing the information associated with the object (714). Thismay include detecting that the second process has released a lock on theobject. In response, or at a regular time interval, the method may alsoinclude combining the first and the second value (716).

In cases where the combination is request based, the method may includereceiving a second request to access the object (708). The secondrequest may be to access, to modify, to view, to query, and/or the like.The method may further include determining that no other processes arecurrently accessing information associated with the object (710). Thismay comprise successfully obtaining a lock on the object, or determiningthat no other processes have a lock on the object.

The method may additionally include determining that the first object isassociated with the first value and the second value (712). In oneembodiment, this may include retrieving a set of rows in a relationaldatabase that include the object's functional primary key. In anotherembodiment, this may include following one or more pointers that areassociated with the object to an additional memory location storing thesecond value.

The method may again include combining the first value in the secondvalue (716). In one embodiment, a third value may also be combined thatis part of the second request to access the object. Combining mayinclude adding, subtracting, multiplying, dividing, and/or any othermathematical or logical combination technique known in the art.Combining the first value and the second value may also include deletingor freeing memory locations that were associated with the second valueand/or the first value. It may also include committing the new combinedvalue to the data structure to overwrite or replace the first valuestored with the object.

It should be appreciated that the specific steps illustrated in FIGS. 4and 7 provide particular methods of providing for concurrent access of adata hierarchy according to various embodiments of the presentinvention. Other sequences of steps may also be performed according toalternative embodiments. For example, alternative embodiments of thepresent invention may perform the steps outlined above in a differentorder, or may perform one step iteratively for all data objects whileperforming another step in parallel using sub-processes or for all thedata objects at once using SQL operations. Moreover, the individualsteps illustrated in FIGS. 4 and 7 may include multiple sub-steps thatmay be performed in various sequences as appropriate to the individualstep. Furthermore, additional steps may be added or removed depending onthe particular applications. One of ordinary skill in the art wouldrecognize many variations, modifications, and alternatives.

FIG. 8 illustrates a block diagram 800 of a data management system 802,according to one embodiment. The data management system 802 may beconstructed using dedicated hardware, such as transistors, resistors,diodes, integrated circuits, etc., as well as other components that arewell known in the art. In other words, the data management system 800need not be implemented in software on a general purpose computer, butrather may be implemented using a special-purpose computer specificallydesigned to carry out the methods described above.

The data management system 802 may include process interfaces 804, 806,along with additional process interfaces that are not shown for brevity,that are configured to receive requests from various processes 814, 816that are communicatively coupled to the data management system 802.These requests may comprise data to be added to a data structure. Thedata management system 802 may include a lock arbiter 808 configured todetermine and govern which of the processes 814, 816 may have exclusiveaccess to one or more objects stored in the data management system 802.The lock arbiter 808 may allow exclusive access to process 816, whileallowing process 814 to associate a value with a locked object.

The data management system 802 may also include a database interface 810configured to manage access and operations to one or more databases. Theone or more databases may include a hierarchy database 812 that storeshierarchical data. The hierarchical data may include eithersingle-parent or multi-parent arrangements. The lock arbiter 808 mayaccess the hierarchy database 812 through the database interface 810 andwrite, retrieve, and/or associate data with various objectrepresentations stored in the hierarchy database 812.

In one embodiment, the various modules and systems in FIG. 8 may resideon separate computer systems. Alternatively, multiple modules may becombined on the same or similar computer systems. In addition, somemodules may be combined together into a single module performing thefunctions of both individual modules. Similarly, a single module may besplit into multiple modules. It will be understood in light of thisdisclosure that any arrangement of the modules, as well as anyimplementation in both software and hardware, may be used by variousembodiments.

In the foregoing description, for the purposes of illustration, methodswere described in a particular order. It should be appreciated that inalternate embodiments, the methods may be performed in a different orderthan that described. It should also be appreciated that the methodsdescribed above may be performed by hardware components or may beembodied in sequences of machine-executable instructions, which may beused to cause a machine, such as a general-purpose or special-purposeprocessor or logic circuits programmed with the instructions to performthe methods. These machine-executable instructions may be stored on oneor more machine readable mediums, such as CD-ROMs or other type ofoptical disks, floppy diskettes, ROMs, RAMs, EPROMs, EEPROMs, magneticor optical cards, flash memory, or other types of machine-readablemediums suitable for storing electronic instructions. Alternatively, themethods may be performed by a combination of hardware and software.

What is claimed is:
 1. A non-transitory, computer-readable storagemedium comprising instructions that, when executed by one or moreprocessors, cause the one or more processors to perform operationscomprising: receiving a first value associated with an object, whereinthe object comprises a node in a hierarchy, and the first value isdirectly associated with the node in the hierarchy; storing the firstvalue and a primary key in a first row of a database; receiving a secondvalue associated with the object, wherein the second value is associatedindirectly with the node in the hierarchy, but associated directly witha child node of the node in the hierarchy; storing the second value andthe primary key in a second row of the database; determining that thefirst row and the second row both include the primary key; and inresponse to determining that the first row and the second row bothinclude the primary key, aggregating the first value and the secondvalue into a single row in the database.
 2. The non-transitory,computer-readable storage medium of claim 1, wherein the first valueassociated with the object is received from a first process.
 3. Thenon-transitory, computer-readable storage medium of claim 2, wherein thesecond value associated with the object is received from a secondprocess that is different from the first process.
 4. The non-transitory,computer-readable storage medium of claim 3, wherein the request fromthe second process is received while the first process has acquired alock on values associated with the object.
 5. The non-transitory,computer-readable storage medium of claim 4, wherein storing the secondvalue and the primary key in a second row of the database is performedwhile the first process has acquired the lock on values associated withthe object.
 6. The non-transitory, computer-readable storage medium ofclaim 1, wherein a total number of rows in the database that include theprimary key is bounded in size by a number of processes attempting toconcurrently acquire a lock on values associated with the object.
 7. Thenon-transitory, computer-readable storage medium of claim 1, whereindetermining that the first row and the second row both include theprimary key is performed as part of a garbage-collection routine.
 8. Thenon-transitory, computer-readable storage medium of claim 1, whereindetermining that the first row and the second row both include theprimary key is performed at a time when no processes have acquired alock on values associated with the object.
 9. The non-transitory,computer-readable storage medium of claim 1, wherein determining thatthe first row and the second row both include the primary key isperformed in response to receiving a third value associated with theobject.
 10. The non-transitory, computer-readable storage medium ofclaim 1, further comprising additional instructions that, when executedby the one or more processors, cause the one or more processors toperform additional operations comprising: receiving a third valueassociated with the object; storing the third value and the primary keyin a third row of the database; determining that the first row, thesecond row, and the third row include the primary key; and in responseto determining that the first row, the second row, and the third rowinclude the primary key, aggregating the first value, the second value,and the third value into a single row in the database.
 11. Thenon-transitory, computer-readable storage medium of claim 1, furthercomprising additional instructions that, when executed by the one ormore processors, cause the one or more processors to perform additionaloperations comprising: storing a first sequence key in the first row ofthe database.
 12. The non-transitory, computer-readable storage mediumof claim 11, further comprising additional instructions that, whenexecuted by the one or more processors, cause the one or more processorsto perform additional operations comprising: storing a second sequencekey in the second row of the database, wherein the first sequence key isdifferent from the second sequence key.
 13. The non-transitory,computer-readable storage medium of claim 12, wherein rows in thedatabase with a same primary key and different sequence keys indicatemultiple values associated with objects to be aggregated into singlerows in the database.
 14. The non-transitory, computer-readable storagemedium of claim 1, wherein receiving the second value associated withthe object is part of a data-rollup operation where values associateddirectly with child nodes are aggregated into values associated directlywith parent nodes.
 15. The non-transitory, computer-readable storagemedium of claim 1, wherein the hierarchy comprises a multi-parenthierarchy.
 16. A method of aggregating multiple values associated withan object, the method comprising: receiving, by a computer system, afirst value associated with the object, wherein the object comprises anode in a hierarchy, and the first value is directly associated with thenode in the hierarchy; storing, by the computer system, the first valueand a primary key in a first row of a database; receiving, by thecomputer system, a second value associated with the object, wherein thesecond value is associated indirectly with the node in the hierarchy,but associated directly with a child node of the node in the hierarchy;storing, by the computer system, the second value and the primary key ina second row of the database; determining, by the computer system, thatthe first row and the second row both include the primary key; and inresponse to determining that the first row and the second row bothinclude the primary key, aggregating, by the computer system, the firstvalue and the second value into a single row in the database.
 17. Asystem comprising: one or more processors; and one or more memorydevices comprising instructions that, when executed by the one or moreprocessors, cause the one or more processors to perform operationscomprising: receiving a first value associated with an object, whereinthe object comprises a node in a hierarchy, and the first value isdirectly associated with the node in the hierarchy; storing the firstvalue and a primary key in a first row of a database; receiving a secondvalue associated with the object, wherein the second value is associatedindirectly with the node in the hierarchy, but associated directly witha child node of the node in the hierarchy; storing the second value andthe primary key in a second row of the database; determining that thefirst row and the second row both include the primary key; and inresponse to determining that the first row and the second row bothinclude the primary key, aggregating the first value and the secondvalue into a single row in the database.